package com.flydog.taskManager.entity;

import lombok.*;
import org.hibernate.Hibernate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Calendar;
import java.util.Date;

/**
 * @author Cao
 * @description 阶段性工作实体
 * @create 2021-05-08
 */

@Entity
@Getter
@Setter
@ToString
@RequiredArgsConstructor
@Table(name = "phased_task")
public class PhasedTask extends Task{

    /**
     * 工作起始时间
     */
    @Column(name = "begin_time", nullable = false)
    private Calendar begin;



    /**
     * 上级工作实体关联ID
     */
    @Column(name = "parent_id")
    private Long parentId;

    /**
     * 本实体所在层级
     */
    @Column(name = "level")
    private Integer level;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
        PhasedTask task = (PhasedTask) o;
        return getId() != null && getId().equals(task.getId());
    }

    @Override
    public int hashCode() {
        return 843567874;
    }
}
